package com.collect.senegal.zhiScene.zhiWidget.zhiDialog;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.widget.TextView;

import com.collect.senegal.R;
import com.collect.senegal.zhiScene.zhiWidget.zhiStepView.ZHINextStepView;

public class ZHIDialogCustomerPerformanceAdminBonusV2 extends Dialog {

    private String name;
    private String bonus;
    private String penalty;
    private String actualBonus;

    private TextView bonusView;
    private TextView penaltyView;
    private TextView actualBonusView;
    private TextView nameView;

    private final Context context;

    public ZHIDialogCustomerPerformanceAdminBonusV2(Context context) {
        super(context, R.style.CustomDialog);
        this.context = context;
    }

    public static ZHIDialogCustomerPerformanceAdminBonusV2 showDataSource(Context context1, String name, String bonus, String penalty, String actualBonus){
        ZHIDialogCustomerPerformanceAdminBonusV2 zhiDialogCustomerPerformanceMember = new ZHIDialogCustomerPerformanceAdminBonusV2(context1);
        zhiDialogCustomerPerformanceMember.name = name;
        zhiDialogCustomerPerformanceMember.bonus = bonus;
        zhiDialogCustomerPerformanceMember.penalty = penalty;
        zhiDialogCustomerPerformanceMember.actualBonus = actualBonus;
        zhiDialogCustomerPerformanceMember.show();
        return zhiDialogCustomerPerformanceMember;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_customer_performance_admin_bonus_v2);
        setCanceledOnTouchOutside(true);
        initView();
        refreshViewData();
        initViewEvent();
    }

    @Override
    public void show() {
        super.show();
        refreshViewData();
    }

    private void initView() {
        ZHINextStepView btn_close = findViewById(R.id.btn_close);
        btn_close.setOnMenuItemDidChangedListener(item -> dismiss());

        nameView = findViewById(R.id.nameView);
        bonusView = findViewById(R.id.bonusView);
        penaltyView = findViewById(R.id.penaltyView);
        actualBonusView = findViewById(R.id.actualBonusView);
    }

    private void refreshViewData() {
        nameView.setText(name);
        bonusView.setText(bonus);
        penaltyView.setText(penalty);
        actualBonusView.setText(actualBonus);
    }

    private void initViewEvent() {


    }
}
